From af45e088627e29bf1070687e033647e87771287e Mon Sep 17 00:00:00 2001 From: Gabriel Souza Franco Date: Fri, 30 Jan 2015 11:48:43 -0200 Subject: [PATCH] =?utf8?q?std::io=20=E2=86=92=20std::old=5Fio?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/bin/bench.rs | 2 +- src/bin/cargo.rs | 12 ++++++------ src/bin/login.rs | 4 ++-- src/bin/run.rs | 2 +- src/bin/test.rs | 2 +- src/bin/verify_project.rs | 2 +- src/cargo/core/shell.rs | 2 +- src/cargo/lib.rs | 6 +++--- src/cargo/ops/cargo_clean.rs | 2 +- src/cargo/ops/cargo_doc.rs | 4 ++-- src/cargo/ops/cargo_new.rs | 8 ++++---- src/cargo/ops/cargo_package.rs | 4 ++-- src/cargo/ops/cargo_read_manifest.rs | 6 +++--- src/cargo/ops/cargo_rustc/custom_build.rs | 4 ++-- src/cargo/ops/cargo_rustc/engine.rs | 2 +- src/cargo/ops/cargo_rustc/fingerprint.rs | 12 ++++++------ src/cargo/ops/cargo_rustc/layout.rs | 8 ++++---- src/cargo/ops/cargo_rustc/mod.rs | 2 +- src/cargo/ops/lockfile.rs | 2 +- src/cargo/ops/registry.rs | 4 ++-- src/cargo/sources/git/utils.rs | 4 ++-- src/cargo/sources/path.rs | 2 +- src/cargo/sources/registry.rs | 10 +++++----- src/cargo/util/config.rs | 6 +++--- src/cargo/util/errors.rs | 4 ++-- src/cargo/util/hex.rs | 2 +- src/cargo/util/important_paths.rs | 2 +- src/cargo/util/paths.rs | 10 +++++----- src/cargo/util/process_builder.rs | 2 +- src/cargo/util/toml.rs | 2 +- src/registry/lib.rs | 6 +++--- tests/support/git.rs | 6 +++--- tests/support/mod.rs | 8 ++++---- tests/support/paths.rs | 16 ++++++++-------- tests/support/registry.rs | 8 ++++---- tests/test_cargo.rs | 10 +++++----- tests/test_cargo_bench.rs | 2 +- tests/test_cargo_build_auth.rs | 4 ++-- tests/test_cargo_compile.rs | 10 +++++----- tests/test_cargo_compile_custom_build.rs | 12 ++++++------ tests/test_cargo_compile_git_deps.rs | 6 +++--- tests/test_cargo_compile_path_deps.rs | 4 ++-- tests/test_cargo_compile_plugins.rs | 4 ++-- tests/test_cargo_features.rs | 2 +- tests/test_cargo_freshness.rs | 2 +- tests/test_cargo_generate_lockfile.rs | 2 +- tests/test_cargo_new.rs | 4 ++-- tests/test_cargo_package.rs | 2 +- tests/test_cargo_publish.rs | 8 ++++---- tests/test_cargo_registry.rs | 4 ++-- tests/test_cargo_search.rs | 6 +++--- tests/test_cargo_test.rs | 2 +- tests/test_shell.rs | 2 +- 53 files changed, 132 insertions(+), 132 deletions(-) diff --git a/src/bin/bench.rs b/src/bin/bench.rs index 7bd2100e5..d057c3626 100644 --- a/src/bin/bench.rs +++ b/src/bin/bench.rs @@ -1,4 +1,4 @@ -use std::io::process::ExitStatus; +use std::old_io::process::ExitStatus; use cargo::ops; use cargo::util::{CliResult, CliError, Human, Config}; diff --git a/src/bin/cargo.rs b/src/bin/cargo.rs index 33b5e9663..f39b6d008 100644 --- a/src/bin/cargo.rs +++ b/src/bin/cargo.rs @@ -6,9 +6,9 @@ extern crate cargo; use std::collections::BTreeSet; use std::os; -use std::io; -use std::io::fs::{self, PathExtensions}; -use std::io::process::{Command,InheritFd,ExitStatus,ExitSignal}; +use std::old_io; +use std::old_io::fs::{self, PathExtensions}; +use std::old_io::process::{Command,InheritFd,ExitStatus,ExitSignal}; use cargo::{execute_main_without_stdin, handle_error, shell}; use cargo::core::MultiShell; @@ -175,7 +175,7 @@ fn execute_subcommand(cmd: &str, args: &[String], shell: &mut MultiShell) { let msg = format!("subcommand failed with signal: {}", i); handle_error(CliError::new(msg, i as u32), shell) } - Err(io::IoError{kind, ..}) if kind == io::FileNotFound => + Err(old_io::IoError{kind, ..}) if kind == old_io::FileNotFound => handle_error(CliError::new("No such subcommand", 127), shell), Err(err) => handle_error( CliError::new( @@ -219,8 +219,8 @@ fn list_commands() -> BTreeSet { fn is_executable(path: &Path) -> bool { match fs::stat(path) { - Ok(io::FileStat{ kind: io::FileType::RegularFile, perm, ..}) => - perm.contains(io::OTHER_EXECUTE), + Ok(old_io::FileStat{ kind: old_io::FileType::RegularFile, perm, ..}) => + perm.contains(old_io::OTHER_EXECUTE), _ => false } } diff --git a/src/bin/login.rs b/src/bin/login.rs index bf3d707fd..9cb44b706 100644 --- a/src/bin/login.rs +++ b/src/bin/login.rs @@ -1,4 +1,4 @@ -use std::io; +use std::old_io; use cargo::ops; use cargo::core::{SourceId, Source}; @@ -38,7 +38,7 @@ pub fn execute(options: Options, config: &Config) -> CliResult> { let host = options.flag_host.clone().unwrap_or(config.api); println!("please visit {}me and paste the API Token below", host); - let line = try!(io::stdin().read_line()); + let line = try!(old_io::stdin().read_line()); Ok(line) })(); diff --git a/src/bin/run.rs b/src/bin/run.rs index 40e94f578..272c1c830 100644 --- a/src/bin/run.rs +++ b/src/bin/run.rs @@ -1,4 +1,4 @@ -use std::io::process::ExitStatus; +use std::old_io::process::ExitStatus; use cargo::ops; use cargo::core::manifest::TargetKind; diff --git a/src/bin/test.rs b/src/bin/test.rs index 6d20f54f8..3d39d7f8f 100644 --- a/src/bin/test.rs +++ b/src/bin/test.rs @@ -1,4 +1,4 @@ -use std::io::process::ExitStatus; +use std::old_io::process::ExitStatus; use cargo::ops; use cargo::util::{CliResult, CliError, Human, Config}; diff --git a/src/bin/verify_project.rs b/src/bin/verify_project.rs index 95fffab57..54f8d6e80 100644 --- a/src/bin/verify_project.rs +++ b/src/bin/verify_project.rs @@ -1,7 +1,7 @@ extern crate toml; use std::collections::HashMap; -use std::io::File; +use std::old_io::File; use std::os; use cargo::util::{CliResult, Config}; diff --git a/src/cargo/core/shell.rs b/src/cargo/core/shell.rs index 46a5f8c2d..b39861945 100644 --- a/src/cargo/core/shell.rs +++ b/src/cargo/core/shell.rs @@ -1,5 +1,5 @@ use std::fmt; -use std::io::{IoResult, stderr}; +use std::old_io::{IoResult, stderr}; use term::Attr; use term::color::{Color, BLACK, RED, GREEN, YELLOW}; diff --git a/src/cargo/lib.rs b/src/cargo/lib.rs index e141fd20a..6875c41c0 100644 --- a/src/cargo/lib.rs +++ b/src/cargo/lib.rs @@ -23,8 +23,8 @@ extern crate url; extern crate registry; use std::error::Error; -use std::io::stdio::{stdout_raw, stderr_raw}; -use std::io::{self, stdout, stderr}; +use std::old_io::stdio::{stdout_raw, stderr_raw}; +use std::old_io::{self, stdout, stderr}; use std::os; use rustc_serialize::{Decodable, Encodable}; use rustc_serialize::json::{self, Json}; @@ -217,7 +217,7 @@ fn flags_from_args<'a, T>(usage: &str, args: &[String], } fn json_from_stdin() -> CliResult { - let mut reader = io::stdin(); + let mut reader = old_io::stdin(); let input = try!(reader.read_to_string().map_err(|_| { CliError::new("Standard in did not exist or was not UTF-8", 1) })); diff --git a/src/cargo/ops/cargo_clean.rs b/src/cargo/ops/cargo_clean.rs index 592dbab56..97826ccf6 100644 --- a/src/cargo/ops/cargo_clean.rs +++ b/src/cargo/ops/cargo_clean.rs @@ -1,5 +1,5 @@ use std::default::Default; -use std::io::fs::{self, PathExtensions}; +use std::old_io::fs::{self, PathExtensions}; use core::PackageSet; use core::source::{Source, SourceMap}; diff --git a/src/cargo/ops/cargo_doc.rs b/src/cargo/ops/cargo_doc.rs index 251e9e26f..cf41cf9d3 100644 --- a/src/cargo/ops/cargo_doc.rs +++ b/src/cargo/ops/cargo_doc.rs @@ -1,11 +1,11 @@ -use std::io::fs::PathExtensions; +use std::old_io::fs::PathExtensions; use std::collections::HashSet; use core::PackageIdSpec; use core::source::Source; use ops; use sources::PathSource; -use std::io::process::Command; +use std::old_io::process::Command; use util::{CargoResult, human}; pub struct DocOptions<'a, 'b: 'a> { diff --git a/src/cargo/ops/cargo_new.rs b/src/cargo/ops/cargo_new.rs index ab7c1c8d9..3126e4083 100644 --- a/src/cargo/ops/cargo_new.rs +++ b/src/cargo/ops/cargo_new.rs @@ -1,6 +1,6 @@ use std::os; -use std::io::{self, fs, File}; -use std::io::fs::PathExtensions; +use std::old_io::{self, fs, File}; +use std::old_io::fs::PathExtensions; use rustc_serialize::{Decodable, Decoder}; @@ -87,7 +87,7 @@ fn mk(config: &Config, path: &Path, name: &str, try!(File::create(&path.join(".hgignore")).write(ignore.as_bytes())); }, VersionControl::NoVcs => { - try!(fs::mkdir(path, io::USER_RWX)); + try!(fs::mkdir(path, old_io::USER_RWX)); }, }; @@ -110,7 +110,7 @@ version = "0.0.1" authors = ["{}"] "#, name, author).as_slice())); - try!(fs::mkdir(&path.join("src"), io::USER_RWX)); + try!(fs::mkdir(&path.join("src"), old_io::USER_RWX)); if opts.bin { try!(File::create(&path.join("src/main.rs")).write_str("\ diff --git a/src/cargo/ops/cargo_package.rs b/src/cargo/ops/cargo_package.rs index d7ed2bcd1..1a75d9c2d 100644 --- a/src/cargo/ops/cargo_package.rs +++ b/src/cargo/ops/cargo_package.rs @@ -1,5 +1,5 @@ -use std::io::{fs, File, USER_DIR}; -use std::io::fs::PathExtensions; +use std::old_io::{fs, File, USER_DIR}; +use std::old_io::fs::PathExtensions; use std::path; use tar::Archive; diff --git a/src/cargo/ops/cargo_read_manifest.rs b/src/cargo/ops/cargo_read_manifest.rs index 7736bff4d..7bfefa095 100644 --- a/src/cargo/ops/cargo_read_manifest.rs +++ b/src/cargo/ops/cargo_read_manifest.rs @@ -1,7 +1,7 @@ use std::collections::HashSet; use std::error::FromError; -use std::io::fs::PathExtensions; -use std::io::{self, File, fs}; +use std::old_io::fs::PathExtensions; +use std::old_io::{self, File, fs}; use core::{Package,Manifest,SourceId}; use util::{self, CargoResult, human, Config, ChainError}; @@ -86,7 +86,7 @@ fn walk_inner(path: &Path, callback: &mut F) -> CargoResult<()> // can often have some weird permissions on them. let dirs = match fs::readdir(path) { Ok(dirs) => dirs, - Err(ref e) if e.kind == io::PermissionDenied => return Ok(()), + Err(ref e) if e.kind == old_io::PermissionDenied => return Ok(()), Err(e) => return Err(FromError::from_error(e)), }; for dir in dirs.iter() { diff --git a/src/cargo/ops/cargo_rustc/custom_build.rs b/src/cargo/ops/cargo_rustc/custom_build.rs index fd3f6ee20..73bac0682 100644 --- a/src/cargo/ops/cargo_rustc/custom_build.rs +++ b/src/cargo/ops/cargo_rustc/custom_build.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use std::ffi::CString; -use std::io::fs::PathExtensions; -use std::io::{fs, USER_RWX, File}; +use std::old_io::fs::PathExtensions; +use std::old_io::{fs, USER_RWX, File}; use std::str; use std::sync::Mutex; diff --git a/src/cargo/ops/cargo_rustc/engine.rs b/src/cargo/ops/cargo_rustc/engine.rs index e2e590cbd..e3ca33a64 100644 --- a/src/cargo/ops/cargo_rustc/engine.rs +++ b/src/cargo/ops/cargo_rustc/engine.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use std::ffi::CString; use std::fmt::{self, Formatter}; -use std::io::process::ProcessOutput; +use std::old_io::process::ProcessOutput; use std::os; use std::path::BytesContainer; diff --git a/src/cargo/ops/cargo_rustc/fingerprint.rs b/src/cargo/ops/cargo_rustc/fingerprint.rs index f37f35cad..f94316f29 100644 --- a/src/cargo/ops/cargo_rustc/fingerprint.rs +++ b/src/cargo/ops/cargo_rustc/fingerprint.rs @@ -1,6 +1,6 @@ use std::collections::hash_map::Entry::{Occupied, Vacant}; -use std::io::{self, fs, File, BufferedReader}; -use std::io::fs::PathExtensions; +use std::old_io::{self, fs, File, BufferedReader}; +use std::old_io::fs::PathExtensions; use core::{Package, Target}; use util; @@ -268,13 +268,13 @@ pub fn prepare_init(cx: &mut Context, pkg: &Package, kind: Kind) let work1 = Work::new(move |_| { if !new1.exists() { - try!(fs::mkdir(&new1, io::USER_DIR)); + try!(fs::mkdir(&new1, old_io::USER_DIR)); } Ok(()) }); let work2 = Work::new(move |_| { if !new2.exists() { - try!(fs::mkdir(&new2, io::USER_DIR)); + try!(fs::mkdir(&new2, old_io::USER_DIR)); } Ok(()) }); @@ -406,9 +406,9 @@ fn filename(target: &Target) -> String { // next time. pub fn append_current_dir(path: &Path, cwd: &Path) -> CargoResult<()> { debug!("appending {} <- {}", path.display(), cwd.display()); - let mut f = try!(File::open_mode(path, io::Open, io::ReadWrite)); + let mut f = try!(File::open_mode(path, old_io::Open, old_io::ReadWrite)); let contents = try!(f.read_to_end()); - try!(f.seek(0, io::SeekSet)); + try!(f.seek(0, old_io::SeekSet)); try!(f.write(cwd.as_vec())); try!(f.write(&[0])); try!(f.write(&contents[])); diff --git a/src/cargo/ops/cargo_rustc/layout.rs b/src/cargo/ops/cargo_rustc/layout.rs index cccc42a3e..87af32150 100644 --- a/src/cargo/ops/cargo_rustc/layout.rs +++ b/src/cargo/ops/cargo_rustc/layout.rs @@ -47,8 +47,8 @@ use std::cell::RefCell; use std::collections::HashSet; -use std::io::fs::PathExtensions; -use std::io::{self, fs, IoResult}; +use std::old_io::fs::PathExtensions; +use std::old_io::{self, fs, IoResult}; use std::mem; use core::Package; @@ -97,7 +97,7 @@ impl Layout { pub fn prepare(&mut self) -> IoResult<()> { if !self.root.exists() { - try!(fs::mkdir_recursive(&self.root, io::USER_RWX)); + try!(fs::mkdir_recursive(&self.root, old_io::USER_RWX)); } try!(mkdir(self, &self.deps, false)); @@ -128,7 +128,7 @@ impl Layout { } } } else { - try!(fs::mkdir(dir, io::USER_DIR)); + try!(fs::mkdir(dir, old_io::USER_DIR)); } Ok(()) } diff --git a/src/cargo/ops/cargo_rustc/mod.rs b/src/cargo/ops/cargo_rustc/mod.rs index 3d99b3c17..bc91c325b 100644 --- a/src/cargo/ops/cargo_rustc/mod.rs +++ b/src/cargo/ops/cargo_rustc/mod.rs @@ -1,7 +1,7 @@ use std::collections::{HashSet, HashMap}; use std::dynamic_lib::DynamicLibrary; use std::ffi::CString; -use std::io::fs::{self, PathExtensions}; +use std::old_io::fs::{self, PathExtensions}; use std::os; use std::path; use std::sync::Arc; diff --git a/src/cargo/ops/lockfile.rs b/src/cargo/ops/lockfile.rs index 463d94676..8bb4b03d1 100644 --- a/src/cargo/ops/lockfile.rs +++ b/src/cargo/ops/lockfile.rs @@ -1,4 +1,4 @@ -use std::io::File; +use std::old_io::File; use rustc_serialize::{Encodable, Decodable}; use toml::{self, Encoder, Value}; diff --git a/src/cargo/ops/registry.rs b/src/cargo/ops/registry.rs index a554259cc..3c69c0c60 100644 --- a/src/cargo/ops/registry.rs +++ b/src/cargo/ops/registry.rs @@ -1,6 +1,6 @@ use std::collections::HashMap; -use std::io::File; -use std::io::fs::PathExtensions; +use std::old_io::File; +use std::old_io::fs::PathExtensions; use std::iter::repeat; use std::os; diff --git a/src/cargo/sources/git/utils.rs b/src/cargo/sources/git/utils.rs index ce34d2632..86ab4630c 100644 --- a/src/cargo/sources/git/utils.rs +++ b/src/cargo/sources/git/utils.rs @@ -1,6 +1,6 @@ use std::fmt::{self, Formatter}; -use std::io::{USER_DIR}; -use std::io::fs::{mkdir_recursive, rmdir_recursive, PathExtensions}; +use std::old_io::{USER_DIR}; +use std::old_io::fs::{mkdir_recursive, rmdir_recursive, PathExtensions}; use rustc_serialize::{Encodable, Encoder}; use url::Url; use git2::{self, ObjectType}; diff --git a/src/cargo/sources/path.rs b/src/cargo/sources/path.rs index 079c892a2..ff1538d43 100644 --- a/src/cargo/sources/path.rs +++ b/src/cargo/sources/path.rs @@ -1,6 +1,6 @@ use std::cmp; use std::fmt::{self, Debug, Formatter}; -use std::io::fs::{self, PathExtensions}; +use std::old_io::fs::{self, PathExtensions}; use glob::Pattern; use git2; diff --git a/src/cargo/sources/registry.rs b/src/cargo/sources/registry.rs index d3e311cf1..f17aaf772 100644 --- a/src/cargo/sources/registry.rs +++ b/src/cargo/sources/registry.rs @@ -158,8 +158,8 @@ //! ... //! ``` -use std::io::{self, fs, File}; -use std::io::fs::PathExtensions; +use std::old_io::{self, fs, File}; +use std::old_io::fs::PathExtensions; use std::collections::HashMap; use curl::http; @@ -281,7 +281,7 @@ impl<'a, 'b> RegistrySource<'a, 'b> { Err(..) => {} } - try!(fs::mkdir_recursive(&self.checkout_path, io::USER_DIR)); + try!(fs::mkdir_recursive(&self.checkout_path, old_io::USER_DIR)); let _ = fs::rmdir_recursive(&self.checkout_path); let repo = try!(git2::Repository::init(&self.checkout_path)); Ok(repo) @@ -302,7 +302,7 @@ impl<'a, 'b> RegistrySource<'a, 'b> { if dst.exists() { return Ok(dst) } try!(self.config.shell().status("Downloading", pkg)); - try!(fs::mkdir_recursive(&dst.dir_path(), io::USER_DIR)); + try!(fs::mkdir_recursive(&dst.dir_path(), old_io::USER_DIR)); let handle = match self.handle { Some(ref mut handle) => handle, None => { @@ -347,7 +347,7 @@ impl<'a, 'b> RegistrySource<'a, 'b> { pkg.get_version())); if dst.join(".cargo-ok").exists() { return Ok(dst) } - try!(fs::mkdir_recursive(&dst.dir_path(), io::USER_DIR)); + try!(fs::mkdir_recursive(&dst.dir_path(), old_io::USER_DIR)); let f = try!(File::open(&tarball)); let gz = try!(GzDecoder::new(f)); let mut tar = Archive::new(gz); diff --git a/src/cargo/util/config.rs b/src/cargo/util/config.rs index 40cca9153..5393ca909 100644 --- a/src/cargo/util/config.rs +++ b/src/cargo/util/config.rs @@ -2,8 +2,8 @@ use std::{fmt, os, mem}; use std::cell::{RefCell, RefMut, Ref, Cell}; use std::collections::hash_map::{HashMap}; use std::collections::hash_map::Entry::{Occupied, Vacant}; -use std::io; -use std::io::fs::{self, PathExtensions, File}; +use std::old_io; +use std::old_io::fs::{self, PathExtensions, File}; use rustc_serialize::{Encodable,Encoder}; use toml; @@ -432,7 +432,7 @@ pub fn set_config(cfg: &Config, loc: Location, key: &str, Location::Global => cfg.home_path.join("config"), Location::Project => unimplemented!(), }; - try!(fs::mkdir_recursive(&file.dir_path(), io::USER_DIR)); + try!(fs::mkdir_recursive(&file.dir_path(), old_io::USER_DIR)); let contents = File::open(&file).read_to_string().unwrap_or("".to_string()); let mut toml = try!(cargo_toml::parse(contents.as_slice(), &file)); toml.insert(key.to_string(), value.into_toml()); diff --git a/src/cargo/util/errors.rs b/src/cargo/util/errors.rs index c738ed70f..0a528f9ed 100644 --- a/src/cargo/util/errors.rs +++ b/src/cargo/util/errors.rs @@ -1,7 +1,7 @@ use std::error::{FromError, Error}; use std::fmt; -use std::io::IoError; -use std::io::process::{ProcessOutput, ProcessExit, ExitStatus, ExitSignal}; +use std::old_io::IoError; +use std::old_io::process::{ProcessOutput, ProcessExit, ExitStatus, ExitSignal}; use std::str; use semver; diff --git a/src/cargo/util/hex.rs b/src/cargo/util/hex.rs index 1f557b56c..2bce7ea2e 100644 --- a/src/cargo/util/hex.rs +++ b/src/cargo/util/hex.rs @@ -1,4 +1,4 @@ -use std::io::MemWriter; +use std::old_io::MemWriter; use std::hash::{Hasher, Hash, SipHasher}; use rustc_serialize::hex::ToHex; diff --git a/src/cargo/util/important_paths.rs b/src/cargo/util/important_paths.rs index 7abffd655..4ba23b36f 100644 --- a/src/cargo/util/important_paths.rs +++ b/src/cargo/util/important_paths.rs @@ -1,5 +1,5 @@ use std::os; -use std::io::fs::PathExtensions; +use std::old_io::fs::PathExtensions; use util::{CargoResult, CliError, CliResult, human}; /// Iteratively search for `file` in `pwd` and its parents, returning diff --git a/src/cargo/util/paths.rs b/src/cargo/util/paths.rs index b89142732..20525c4db 100644 --- a/src/cargo/util/paths.rs +++ b/src/cargo/util/paths.rs @@ -1,10 +1,10 @@ -use std::{io,os}; -use std::io::fs; +use std::{old_io,os}; +use std::old_io::fs; use std::path::BytesContainer; use util::{human, CargoResult}; -pub fn realpath(original: &Path) -> io::IoResult { +pub fn realpath(original: &Path) -> old_io::IoResult { const MAX_LINKS_FOLLOWED: usize = 256; let original = try!(os::make_absolute(original)); @@ -22,12 +22,12 @@ pub fn realpath(original: &Path) -> io::IoResult { loop { if followed == MAX_LINKS_FOLLOWED { - return Err(io::standard_error(io::InvalidInput)) + return Err(old_io::standard_error(old_io::InvalidInput)) } match fs::lstat(&result) { Err(..) => break, - Ok(ref stat) if stat.kind != io::FileType::Symlink => break, + Ok(ref stat) if stat.kind != old_io::FileType::Symlink => break, Ok(..) => { followed += 1; let path = try!(fs::readlink(&result)); diff --git a/src/cargo/util/process_builder.rs b/src/cargo/util/process_builder.rs index e66c42c3a..28de7dfff 100644 --- a/src/cargo/util/process_builder.rs +++ b/src/cargo/util/process_builder.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use std::ffi::CString; use std::fmt::{self, Formatter}; -use std::io::process::{Command, ProcessOutput, InheritFd}; +use std::old_io::process::{Command, ProcessOutput, InheritFd}; use std::os; use std::path::BytesContainer; diff --git a/src/cargo/util/toml.rs b/src/cargo/util/toml.rs index bf6a017de..d86b75bb8 100644 --- a/src/cargo/util/toml.rs +++ b/src/cargo/util/toml.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use std::fmt; -use std::io::fs::{self, PathExtensions}; +use std::old_io::fs::{self, PathExtensions}; use std::os; use std::slice; use std::str; diff --git a/src/registry/lib.rs b/src/registry/lib.rs index 8a099872d..bcd73b520 100644 --- a/src/registry/lib.rs +++ b/src/registry/lib.rs @@ -4,9 +4,9 @@ extern crate curl; extern crate "rustc-serialize" as rustc_serialize; use std::fmt; -use std::io::{self, fs, MemReader, MemWriter, File}; +use std::old_io::{self, fs, MemReader, MemWriter, File}; use std::collections::HashMap; -use std::io::util::ChainedReader; +use std::old_io::util::ChainedReader; use std::result; use curl::http; @@ -36,7 +36,7 @@ pub enum Error { Api(Vec), Unauthorized, TokenMissing, - Io(io::IoError), + Io(old_io::IoError), } #[derive(RustcDecodable)] diff --git a/tests/support/git.rs b/tests/support/git.rs index af8fef689..116819fcb 100644 --- a/tests/support/git.rs +++ b/tests/support/git.rs @@ -1,4 +1,4 @@ -use std::io::{self, fs, File}; +use std::old_io::{self, fs, File}; use url::Url; use git2; @@ -14,7 +14,7 @@ pub fn repo(p: &Path) -> RepoBuilder { RepoBuilder::init(p) } impl RepoBuilder { pub fn init(p: &Path) -> RepoBuilder { - fs::mkdir_recursive(&p.dir_path(), io::USER_DIR).unwrap(); + fs::mkdir_recursive(&p.dir_path(), old_io::USER_DIR).unwrap(); let repo = git2::Repository::init(p).unwrap(); { let mut config = repo.config().unwrap(); @@ -33,7 +33,7 @@ impl RepoBuilder { pub fn nocommit_file(self, path: &str, contents: T) -> RepoBuilder { let dst = self.repo.path().dir_path().join(path); - fs::mkdir_recursive(&dst.dir_path(), io::USER_DIR).unwrap(); + fs::mkdir_recursive(&dst.dir_path(), old_io::USER_DIR).unwrap(); File::create(&dst).write_str(contents.as_slice()).unwrap(); self } diff --git a/tests/support/mod.rs b/tests/support/mod.rs index 4a814821e..4fe302caf 100644 --- a/tests/support/mod.rs +++ b/tests/support/mod.rs @@ -1,8 +1,8 @@ use std::error::Error; use std::fmt; -use std::io::fs::{self, PathExtensions}; -use std::io::process::{ProcessOutput}; -use std::io; +use std::old_io::fs::{self, PathExtensions}; +use std::old_io::process::{ProcessOutput}; +use std::old_io; use std::os; use std::path::{Path, BytesContainer}; use std::str::{self, Str}; @@ -186,7 +186,7 @@ pub fn project(name: &str) -> ProjectBuilder { // === Helpers === pub fn mkdir_recursive(path: &Path) -> Result<(), String> { - fs::mkdir_recursive(path, io::USER_DIR) + fs::mkdir_recursive(path, old_io::USER_DIR) .with_err_msg(format!("could not create directory; path={}", path.display())) } diff --git a/tests/support/paths.rs b/tests/support/paths.rs index 3039ce9df..cbecafcf6 100644 --- a/tests/support/paths.rs +++ b/tests/support/paths.rs @@ -1,7 +1,7 @@ -use std::io::IoResult; -use std::io::fs::{self, PathExtensions}; +use std::old_io::IoResult; +use std::old_io::fs::{self, PathExtensions}; use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; -use std::{io, os}; +use std::{old_io, os}; use cargo::util::realpath; @@ -41,11 +41,11 @@ impl PathExt for Path { // and change everything to have write permissions, then remove // everything. match fs::rmdir_recursive(self) { - Err(io::IoError { kind: io::PermissionDenied, .. }) => {} + Err(old_io::IoError { kind: old_io::PermissionDenied, .. }) => {} e => return e, } for path in try!(fs::walk_dir(self)) { - try!(fs::chmod(&path, io::USER_RWX)); + try!(fs::chmod(&path, old_io::USER_RWX)); } fs::rmdir_recursive(self) } else { @@ -54,7 +54,7 @@ impl PathExt for Path { } fn mkdir_p(&self) -> IoResult<()> { - fs::mkdir_recursive(self, io::USER_DIR) + fs::mkdir_recursive(self, old_io::USER_DIR) } fn move_into_the_past(&self) -> IoResult<()> { @@ -79,10 +79,10 @@ impl PathExt for Path { // Sadly change_file_times has the same failure mode as the above // rmdir_recursive :( match fs::change_file_times(path, newtime, newtime) { - Err(io::IoError { kind: io::PermissionDenied, .. }) => {} + Err(old_io::IoError { kind: old_io::PermissionDenied, .. }) => {} e => return e, } - try!(fs::chmod(path, stat.perm | io::USER_WRITE)); + try!(fs::chmod(path, stat.perm | old_io::USER_WRITE)); fs::change_file_times(path, newtime, newtime) } } diff --git a/tests/support/registry.rs b/tests/support/registry.rs index 4c3a2be18..6749f2966 100644 --- a/tests/support/registry.rs +++ b/tests/support/registry.rs @@ -1,4 +1,4 @@ -use std::io::{self, fs, File}; +use std::old_io::{self, fs, File}; use flate2::CompressionLevel::Default; use flate2::writer::GzEncoder; @@ -19,7 +19,7 @@ pub fn dl_url() -> Url { Url::from_file_path(&dl_path()).ok().unwrap() } pub fn init() { let config = paths::home().join(".cargo/config"); - fs::mkdir_recursive(&config.dir_path(), io::USER_DIR).unwrap(); + fs::mkdir_recursive(&config.dir_path(), old_io::USER_DIR).unwrap(); File::create(&config).write_str(format!(r#" [registry] index = "{reg}" @@ -57,7 +57,7 @@ pub fn mock_archive(name: &str, version: &str, deps: &[(&str, &str, &str)]) { p.build(); let dst = mock_archive_dst(name, version); - fs::mkdir_recursive(&dst.dir_path(), io::USER_DIR).unwrap(); + fs::mkdir_recursive(&dst.dir_path(), old_io::USER_DIR).unwrap(); let f = File::create(&dst).unwrap(); let a = Archive::new(GzEncoder::new(f, Default)); a.append(format!("{}-{}/Cargo.toml", name, version).as_slice(), @@ -96,7 +96,7 @@ pub fn publish(file: &str, line: &str) { { let dst = registry_path().join(file); let prev = File::open(&dst).read_to_string().unwrap_or(String::new()); - fs::mkdir_recursive(&dst.dir_path(), io::USER_DIR).unwrap(); + fs::mkdir_recursive(&dst.dir_path(), old_io::USER_DIR).unwrap(); File::create(&dst).write_str((prev + line + "\n").as_slice()).unwrap(); } index.add_path(&Path::new(file)).unwrap(); diff --git a/tests/test_cargo.rs b/tests/test_cargo.rs index 618ad281d..2eda962b4 100644 --- a/tests/test_cargo.rs +++ b/tests/test_cargo.rs @@ -1,6 +1,6 @@ -use std::io::fs; -use std::io; -use std::io::{USER_RWX, File}; +use std::old_io::fs; +use std::old_io; +use std::old_io::{USER_RWX, File}; use std::os; use std::str; use cargo::util::process; @@ -18,8 +18,8 @@ fn fake_executable(proj: ProjectBuilder, dir: &Path, name: &str) -> ProjectBuild let path = proj.root().join(dir).join(format!("{}{}", name, os::consts::EXE_SUFFIX)); mkdir_recursive(&Path::new(path.dirname())).unwrap(); fs::File::create(&path).unwrap(); - let io::FileStat{perm, ..} = fs::stat(&path).unwrap(); - fs::chmod(&path, io::OTHER_EXECUTE | perm).unwrap(); + let old_io::FileStat{perm, ..} = fs::stat(&path).unwrap(); + fs::chmod(&path, old_io::OTHER_EXECUTE | perm).unwrap(); proj } diff --git a/tests/test_cargo_bench.rs b/tests/test_cargo_bench.rs index bad1e62e5..68109b5a7 100644 --- a/tests/test_cargo_bench.rs +++ b/tests/test_cargo_bench.rs @@ -630,7 +630,7 @@ test!(bin_there_for_integration { ") .file("benches/foo.rs", r#" extern crate test; - use std::io::Command; + use std::old_io::Command; #[bench] fn bench_bench(_b: &mut test::Bencher) { let status = Command::new("target/release/foo").status().unwrap(); diff --git a/tests/test_cargo_build_auth.rs b/tests/test_cargo_build_auth.rs index ff6bdf699..08592b77a 100644 --- a/tests/test_cargo_build_auth.rs +++ b/tests/test_cargo_build_auth.rs @@ -1,6 +1,6 @@ use std::collections::HashSet; -use std::io::net::tcp::TcpAcceptor; -use std::io::{TcpListener, Listener, Acceptor, BufferedStream}; +use std::old_io::net::tcp::TcpAcceptor; +use std::old_io::{TcpListener, Listener, Acceptor, BufferedStream}; use std::thread::Thread; use git2; diff --git a/tests/test_cargo_compile.rs b/tests/test_cargo_compile.rs index b164e5f85..886c7dfc1 100644 --- a/tests/test_cargo_compile.rs +++ b/tests/test_cargo_compile.rs @@ -1,4 +1,4 @@ -use std::io::{self, fs, TempDir, File}; +use std::old_io::{self, fs, TempDir, File}; use std::os; use std::path; @@ -1294,7 +1294,7 @@ test!(rebuild_preserves_out_dir { "#) .file("build.rs", r#" use std::os; - use std::io::File; + use std::old_io::File; fn main() { let path = Path::new(os::getenv("OUT_DIR").unwrap()).join("foo"); @@ -1378,10 +1378,10 @@ test!(ignore_bad_directories { "#) .file("src/lib.rs", ""); foo.build(); - fs::mkdir(&foo.root().join("tmp"), io::USER_EXEC ^ io::USER_EXEC).unwrap(); + fs::mkdir(&foo.root().join("tmp"), old_io::USER_EXEC ^ old_io::USER_EXEC).unwrap(); assert_that(foo.process(cargo_dir().join("cargo")).arg("build"), execs().with_status(0)); - fs::chmod(&foo.root().join("tmp"), io::USER_DIR).unwrap(); + fs::chmod(&foo.root().join("tmp"), old_io::USER_DIR).unwrap(); }); test!(bad_cargo_config { @@ -1568,7 +1568,7 @@ test!(compile_then_delete { assert_that(&p.bin("foo"), existing_file()); if cfg!(windows) { // HACKHACK: On windows unlinking immediately after running often fails, so sleep - use std::io::timer::sleep; + use std::old_io::timer::sleep; use std::time::duration::Duration; sleep(Duration::milliseconds(100)); } diff --git a/tests/test_cargo_compile_custom_build.rs b/tests/test_cargo_compile_custom_build.rs index b339a1262..0b72cde37 100644 --- a/tests/test_cargo_compile_custom_build.rs +++ b/tests/test_cargo_compile_custom_build.rs @@ -1,4 +1,4 @@ -use std::io::{File, fs}; +use std::old_io::{File, fs}; use std::os; use support::{project, execs, cargo_dir}; @@ -77,7 +77,7 @@ test!(custom_build_env_vars { let file_content = format!(r#" use std::os; - use std::io::fs::PathExtensions; + use std::old_io::fs::PathExtensions; fn main() {{ let _target = os::getenv("TARGET").unwrap(); @@ -724,7 +724,7 @@ test!(out_dir_is_preserved { .file("src/lib.rs", "") .file("build.rs", r#" use std::os; - use std::io::File; + use std::old_io::File; fn main() { let out = os::getenv("OUT_DIR").unwrap(); File::create(&Path::new(out).join("foo")).unwrap(); @@ -739,7 +739,7 @@ test!(out_dir_is_preserved { // Change to asserting that it's there File::create(&p.root().join("build.rs")).write_str(r#" use std::os; - use std::io::File; + use std::old_io::File; fn main() { let out = os::getenv("OUT_DIR").unwrap(); File::open(&Path::new(out).join("foo")).unwrap(); @@ -804,7 +804,7 @@ test!(code_generation { "#) .file("build.rs", r#" use std::os; - use std::io::File; + use std::old_io::File; fn main() { let dst = Path::new(os::getenv("OUT_DIR").unwrap()); @@ -968,7 +968,7 @@ test!(test_a_lib_with_a_build_command { "#) .file("build.rs", r#" use std::os; - use std::io::File; + use std::old_io::File; fn main() { let out = Path::new(os::getenv("OUT_DIR").unwrap()); diff --git a/tests/test_cargo_compile_git_deps.rs b/tests/test_cargo_compile_git_deps.rs index e04f2f5ed..5777e1a52 100644 --- a/tests/test_cargo_compile_git_deps.rs +++ b/tests/test_cargo_compile_git_deps.rs @@ -1,5 +1,5 @@ -use std::io::fs; -use std::io::{timer, File}; +use std::old_io::fs; +use std::old_io::{timer, File}; use std::time::Duration; use git2; @@ -1259,7 +1259,7 @@ test!(git_dep_build_cmd { pub fn gimme() -> int { 0 } "#) .file("bar/build.rs", r#" - use std::io::fs; + use std::old_io::fs; fn main() { fs::copy(&Path::new("src/bar.rs.in"), &Path::new("src/bar.rs")).unwrap(); diff --git a/tests/test_cargo_compile_path_deps.rs b/tests/test_cargo_compile_path_deps.rs index 7ca80b5dd..31d3ad185 100644 --- a/tests/test_cargo_compile_path_deps.rs +++ b/tests/test_cargo_compile_path_deps.rs @@ -1,4 +1,4 @@ -use std::io::{fs, File, USER_RWX}; +use std::old_io::{fs, File, USER_RWX}; use support::{project, execs, main_file, cargo_dir}; use support::{COMPILING, RUNNING}; @@ -665,7 +665,7 @@ test!(path_dep_build_cmd { name = "bar" "#) .file("bar/build.rs", r#" - use std::io::fs; + use std::old_io::fs; fn main() { fs::copy(&Path::new("src/bar.rs.in"), &Path::new("src/bar.rs")).unwrap(); diff --git a/tests/test_cargo_compile_plugins.rs b/tests/test_cargo_compile_plugins.rs index f2a5d7af1..e375e3727 100644 --- a/tests/test_cargo_compile_plugins.rs +++ b/tests/test_cargo_compile_plugins.rs @@ -1,4 +1,4 @@ -use std::io::fs; +use std::old_io::fs; use std::os; use support::{project, execs, cargo_dir}; @@ -138,7 +138,7 @@ test!(plugin_with_dynamic_native_dependency { plugin = true "#) .file("bar/build.rs", r#" - use std::io::fs; + use std::old_io::fs; use std::os; fn main() { diff --git a/tests/test_cargo_features.rs b/tests/test_cargo_features.rs index 7536c7cf3..9f39f22e6 100644 --- a/tests/test_cargo_features.rs +++ b/tests/test_cargo_features.rs @@ -1,4 +1,4 @@ -use std::io::File; +use std::old_io::File; use support::{project, execs, cargo_dir}; use support::{COMPILING, FRESH}; diff --git a/tests/test_cargo_freshness.rs b/tests/test_cargo_freshness.rs index 9b6c6cb55..407a04a94 100644 --- a/tests/test_cargo_freshness.rs +++ b/tests/test_cargo_freshness.rs @@ -1,4 +1,4 @@ -use std::io::{fs, File}; +use std::old_io::{fs, File}; use support::{project, execs, path2url}; use support::{COMPILING, cargo_dir}; diff --git a/tests/test_cargo_generate_lockfile.rs b/tests/test_cargo_generate_lockfile.rs index 52dade301..a9c1c420f 100644 --- a/tests/test_cargo_generate_lockfile.rs +++ b/tests/test_cargo_generate_lockfile.rs @@ -1,4 +1,4 @@ -use std::io::File; +use std::old_io::File; use support::{project, execs, cargo_dir}; use hamcrest::assert_that; diff --git a/tests/test_cargo_new.rs b/tests/test_cargo_new.rs index 9bc5491a9..b78d42c8c 100644 --- a/tests/test_cargo_new.rs +++ b/tests/test_cargo_new.rs @@ -1,5 +1,5 @@ -use std::io::{fs, USER_RWX, File, TempDir}; -use std::io::fs::PathExtensions; +use std::old_io::{fs, USER_RWX, File, TempDir}; +use std::old_io::fs::PathExtensions; use std::os; use support::{execs, paths, cargo_dir}; diff --git a/tests/test_cargo_package.rs b/tests/test_cargo_package.rs index ccbc55a5a..30ab3ce4b 100644 --- a/tests/test_cargo_package.rs +++ b/tests/test_cargo_package.rs @@ -1,4 +1,4 @@ -use std::io::{File, MemReader}; +use std::old_io::{File, MemReader}; use tar::Archive; use flate2::reader::GzDecoder; diff --git a/tests/test_cargo_publish.rs b/tests/test_cargo_publish.rs index 62b5f129e..760aa1cd5 100644 --- a/tests/test_cargo_publish.rs +++ b/tests/test_cargo_publish.rs @@ -1,4 +1,4 @@ -use std::io::{self, fs, File, MemReader}; +use std::old_io::{self, fs, File, MemReader}; use flate2::reader::GzDecoder; use tar::Archive; @@ -18,13 +18,13 @@ fn upload() -> Url { Url::from_file_path(&upload_path()).ok().unwrap() } fn setup() { let config = paths::root().join(".cargo/config"); - fs::mkdir_recursive(&config.dir_path(), io::USER_DIR).unwrap(); + fs::mkdir_recursive(&config.dir_path(), old_io::USER_DIR).unwrap(); File::create(&config).write_str(format!(r#" [registry] index = "{reg}" token = "api-token" "#, reg = registry()).as_slice()).unwrap(); - fs::mkdir_recursive(&upload_path().join("api/v1/crates"), io::USER_DIR).unwrap(); + fs::mkdir_recursive(&upload_path().join("api/v1/crates"), old_io::USER_DIR).unwrap(); repo(®istry_path()) .file("config.json", format!(r#"{{ @@ -61,7 +61,7 @@ test!(simple { let mut f = File::open(&upload_path().join("api/v1/crates/new")).unwrap(); // Skip the metadata payload and the size of the tarball let sz = f.read_le_u32().unwrap(); - f.seek(sz as i64 + 4, io::SeekCur).unwrap(); + f.seek(sz as i64 + 4, old_io::SeekCur).unwrap(); // Verify the tarball let mut rdr = GzDecoder::new(f).unwrap(); diff --git a/tests/test_cargo_registry.rs b/tests/test_cargo_registry.rs index 2873d2ee3..c372aff67 100644 --- a/tests/test_cargo_registry.rs +++ b/tests/test_cargo_registry.rs @@ -1,4 +1,4 @@ -use std::io::{self, fs, File}; +use std::old_io::{self, fs, File}; use cargo::util::process; use support::{project, execs, cargo_dir}; @@ -512,7 +512,7 @@ test!(dev_dependency_not_used { test!(login_with_no_cargo_dir { let home = paths::home().join("new-home"); - fs::mkdir(&home, io::USER_DIR).unwrap(); + fs::mkdir(&home, old_io::USER_DIR).unwrap(); assert_that(process(cargo_dir().join("cargo")).unwrap() .arg("login").arg("foo").arg("-v") .cwd(paths::root()) diff --git a/tests/test_cargo_search.rs b/tests/test_cargo_search.rs index e265bbbb4..e67eed073 100644 --- a/tests/test_cargo_search.rs +++ b/tests/test_cargo_search.rs @@ -1,4 +1,4 @@ -use std::io::{self, fs, File}; +use std::old_io::{self, fs, File}; use url::Url; @@ -17,12 +17,12 @@ fn api() -> Url { Url::from_file_path(&api_path()).ok().unwrap() } fn setup() { let config = paths::root().join(".cargo/config"); - fs::mkdir_recursive(&config.dir_path(), io::USER_DIR).unwrap(); + fs::mkdir_recursive(&config.dir_path(), old_io::USER_DIR).unwrap(); File::create(&config).write_str(format!(r#" [registry] index = "{reg}" "#, reg = registry()).as_slice()).unwrap(); - fs::mkdir_recursive(&api_path().join("api/v1"), io::USER_DIR).unwrap(); + fs::mkdir_recursive(&api_path().join("api/v1"), old_io::USER_DIR).unwrap(); repo(®istry_path()) .file("config.json", format!(r#"{{ diff --git a/tests/test_cargo_test.rs b/tests/test_cargo_test.rs index 032154a16..4edd7922e 100644 --- a/tests/test_cargo_test.rs +++ b/tests/test_cargo_test.rs @@ -633,7 +633,7 @@ test!(bin_there_for_integration { #[test] fn main_test() {} ") .file("tests/foo.rs", r#" - use std::io::Command; + use std::old_io::Command; #[test] fn test_test() { let status = Command::new("target/foo").status().unwrap(); diff --git a/tests/test_shell.rs b/tests/test_shell.rs index 0b658a886..559f672cb 100644 --- a/tests/test_shell.rs +++ b/tests/test_shell.rs @@ -1,4 +1,4 @@ -use std::io::{MemWriter, IoResult, ChanReader, ChanWriter}; +use std::old_io::{MemWriter, IoResult, ChanReader, ChanWriter}; use std::sync::mpsc::channel; use term::{Terminal, TerminfoTerminal, color}; use hamcrest::{assert_that}; -- 2.30.2